//
//  SelectCollectionViewCell.m
//  GiftItems
//
//  Created by lanou3g on 15/9/18.
//  Copyright (c) 2015年 lanou3g. All rights reserved.
//

#import "SelectCollectionViewCell.h"

@implementation SelectCollectionViewCell

- (instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        self.backgroundColor = [UIColor clearColor];
        
        //获取当前cell的宽和高
        CGFloat width = frame.size.width;
        CGFloat height = frame.size.height;
        
        //初始化用心挑礼页面图片
        _selectView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, width, height - 20)];
        _selectView.layer.masksToBounds = YES;
        _selectView.layer.borderWidth = 2;
        _selectView.layer.cornerRadius = _selectView.bounds.size.height / 2;
        _selectView.layer.borderColor = [[UIColor whiteColor] CGColor];
        [self addSubview:_selectView];
        
        
        //初始化图片名字
        _nameLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, height - 20, width, 20)];
        _nameLabel.textAlignment = NSTextAlignmentCenter;
        _nameLabel.font = [UIFont boldSystemFontOfSize:15];
        _nameLabel.textColor = [UIColor blackColor];
        [self addSubview:_nameLabel];
    }
    return self;
}
- (void)setValueW:(SelectModel *)model{
    [_selectView sd_setImageWithURL:[NSURL URLWithString:model.icon_url] placeholderImage:[UIImage imageNamed:@"loading_03.png"]];
    _nameLabel.text = model.name;
    
}

@end
